#!/usr/bin/expect
set v_passwd "*assword*"
set timeout 8
set docker_id   [lindex $argv 0 ]
set host_ip     [lindex $argv 1 ]
set user_passwd [lindex $argv 2 ]
set ssh_port    [lindex $argv 3 ]
spawn ssh -l $user_name $host_ip  -p $ssh_port
expect {
    "*password:"    
    {
        send "$user_passwd\r"
    }
    "*root*"    
    {
        send "docker exec -ti $docker_id /bin/bash \r"
        exp_continue
    }
    "Last login*" 
    {
    }
}
interact

